package cn.jc.spider.neww.storer;

import java.util.List;
import java.util.Map;

import org.apache.commons.collections.CollectionUtils;
import org.apache.torque.TorqueException;
import org.apache.torque.util.Criteria;

import cn.jc.spider.po.DataXiaohua;
import cn.jc.spider.po.DataXiaohuaPeer;


/**
 * 快乐麻花
 * 
 * @author JiangChi
 *
 */
public class StorerXiaohuaImpl extends StorerImpl {
	private int timetime = 0;//记录重复次数
	int time;
	@Override
	public void saveOneObject(Map<String, Object> m) {
		System.out.println(m);
		Criteria cccc = buildCriteria(
				DataXiaohuaPeer.TABLE_NAME, m);//data_xiaohua
		try {
			Criteria ccc = new Criteria();
			ccc.add(DataXiaohuaPeer.URL, m.get("url"));
			List<DataXiaohua> dxs = DataXiaohuaPeer.doSelect(ccc);
			if (CollectionUtils.isEmpty(dxs)) {
				DataXiaohuaPeer.doInsert(cccc);
			} else {
				timetime++;
			}
		} catch (TorqueException e) {
			e.printStackTrace();
		}
	}
	public int getTimetime() {
		return timetime;
	}
	public void setTimetime(int timetime) {
		this.timetime = timetime;
	}
	public int getTime() {
		return time;
	}
	public void setTime(int time) {
		this.time = time;
	}
	public StorerXiaohuaImpl(int time) {
		super();
		this.time = time;
	}
	
}
